//
//  main.cpp
//  example00005
//
//  Created by kazarus on 7/8/15.
//  Copyright (c) 2015 kazarus. All rights reserved.
//

#include <iostream>
#include "3des.h"

int main(int argc, const char * argv[])
{	int i;
    char key[24]={ 'a', '3', 'a', 'c', 'd', '7','9','a', 'b', '3', 'd', 'c', 'd', 'v','9'};
    char msg[]={ 'a', 'b', '2', '4', 'c', 'd', '7', 'f','a', 'b', '3', '4', 'c',
        '7', 'f','a', 'b', '3', '4', 'c', 'b', '3', '3', '4', 'c', 'b', '3', '3', '4', 'c', 'b', '3', '3', '4', 'c', 'b', '3'
        , '3', '4', 'c', 'b', '3', '3', '4', 'c', 'b', '3', '3', '4', 'c', 'b', '3'};
    int j = sizeof(msg);
    //const int length = ((j/8)+((j%8==0)?0:1))*8;
    char cipher[64];//ø…“‘œ»∑÷≈‰“ª∏ˆ◊„πª¥Ûµƒ¥Ê¥¢ø’º‰¥Ê¥¢÷–º‰√‹ŒƒΩ·π˚
    char result[64];//ø…“‘œ»∑÷≈‰“ª∏ˆ◊„πª¥Ûµƒ¥Ê¥¢ø’º‰£¨∏˘æ›√˜Œƒ≥§∂»¿¥»°Ω‚√‹∫Ûµƒœ˚œ¢≥§∂»
    
    // 	printf("%d\n",sizeof(msg));
    // 	printf("%d\n",sizeof(cipher));
    puts("√‹‘ø:");
    for (i=0;i<8;i++)
    {
        printf("%d,",key[i]);
    }
    printf("\n");
    puts("‘≠œ˚œ¢:");
    for (i=0;i<sizeof(msg);i++)
    {
        printf("%d,",msg[i]);
    }
    printf("\n");
    
    /***************º”√‹**************************/
    Encrypt(msg, key, cipher,sizeof(msg));
    /*****************************************/
    puts("º”√‹∫Û:");
    for ( i=0;i<sizeof(cipher);i++)
    {
        printf("%d,",cipher[i]);
    }
    printf("\n");
    
    /*****************Ω‚√‹************************/
    Decrypt(cipher, key, result,sizeof(cipher));
    /*****************************************/
    puts("Ω‚√‹∫Û:");
    for ( i=0;i<sizeof(cipher);i++)
    {
        printf("%d,",result[i]);
    }
    printf("\n");
    getchar();
    
    // insert code here...
    std::cout << "Hello, World!\n";
    return 0;
}
